"use client"; import { GlobalNoticeRep } from "@/api/home"; import Box from "@/components/Box"; import Empty from "@/components/Empty"; import { timeFormat } from "@/utils/methods"; import { Badge, Collapse } from "antd-mobile"; import { useLocale } from "next-intl"; import style from "./style.module.scss"; interface Props { data: GlobalNoticeRep[]; type: "system" | "user"; handler: (active: string, key: Props["type"]) => void; } const SystemMessage = (props: Props) => { const { data, type, handler } = props; const locale = useLocale(); const collapseChange = async (active: string | null) => { if (!active) return; handler && handler(active, type); }; if (!data.length) return ; return (
{data.map((notice, index) => ( {/* */} { !notice.is_read &&
}
} title={
{notice.content?.title}

{notice.send_time ? timeFormat(notice.send_time!, locale) : timeFormat(notice.send_user_time!, locale)}

} >

{notice.content?.text}

{notice.content?.word}

))} ); }; export default SystemMessage;